feat(core): render message actions as buttons on toast notifications - #526
feat(core): render message actions as buttons on toast notifications#526dvcolomban wants to merge 4 commits into
Conversation
Toasts only exposed the dismiss ✕ button; an entry's own `actions` (e.g. an `activate` action that focuses a dock) were only rendered in the messages panel's detail view. Render them as buttons in the toast's `#actions` slot too, dispatching the same way the messages panel does: `switchEntry(action.activate.dockId)`, the local counterpart of the `hub:docks:activate` RPC our shell already handles in `context.ts`.
`switchEntry('devframes-plugin-messages')` (hyphens) never matched the
actual mounted dock id, `devframes_plugin_messages` (`PLUGIN_ID` in
`@devframes/plugin-messages`'s `constants.ts`) — a typo introduced by
the devframe 0.6 migration (vitejs#396). Clicking a toast to open the
messages panel silently no-op'd; same typo had just been copied into
the new `WithAction` story added alongside toast action buttons.
Manual coverage for the new toast action buttons (previous commit): "Toast: With Action" fires a message with a `view` action that focuses the messages dock, exercising `ToastOverlay`'s new `#actions` rendering and `dispatchAction` end to end alongside the existing Quick Actions.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
|
Thanks for this fix! As of #529, the client UI previously at
Thank you for the work, and sorry for the churn from the migration. Feel free to pick up the hub-ui port yourself (linking back to this PR) if you'd like; otherwise we'll route it through the linked issue. |
Why
Toasts only ever showed the dismiss ✕ — an entry's own
actions(e.g. theactivatekind, which focuses a dock) only rendered in the messages panel's detail view, not on the toast that actually announced it.What changed
entry.actionsas buttons in the toast's own#actionsslot, dispatching the same way the messages panel does:switchEntry(action.activate.dockId).switchEntry('devframes-plugin-messages')(hyphens) never matched the dock's real mounted id,devframes_plugin_messages(underscores,PLUGIN_IDin@devframes/plugin-messages'sconstants.ts) — a typo from the devframe 0.6 migration (feat!: migrate to devframe 0.6 — official plugins, crossws + OTP auth #396) that's been silently breaking "click a toast to open messages" ever since.Linked Issues
Additional context
Verified by hand against the playground: firing the new demo toast and clicking its action button focuses the messages dock. Full gate (
pnpm build/test/typecheck/lint) green — 381 tests passing.